cmake_minimum_required(VERSION 2.4)

#project name
set(PROJECTNAME pipe)

#output path
# set out put path
SET(LIBRARY_OUTPUT_PATH ./lib)

project(${PROJECTNAME})

set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)

# find lib at /usr/lib
FIND_LIBRARY(PTHREAD_LIB pthread /usr/lib)

#include directories
include_directories(
	./
	../anet
	../anet/asio
	../anet/timer
	../anet/log
	../anet/pool
	../anet/util
	../service_discovery
	)

#library.
SET(LIBRARIES
    -lpthread
    )

#link directories
link_directories(
	)

#definition flag
add_definitions(
	-std=c++17 
	-g 
	-O3 
	#-Wno-unused-variable 
	-Wall 
	#-Wno-deprecated
)

#output path
set(EXECUTABLE_OUTPUT_PATH ${OUTPUT})

#project src files
file(GLOB SRC_FILES "*.cpp" "*.hpp" "*.h" "*.c" "*.cc")
aux_source_directory(../anet ANET_FILES)
aux_source_directory(../anet/timer TIMER_SRC)
aux_source_directory(../anet/log LOG_SRC)

#merge src files to SRC.
set(SRC
    ${SRC_FILES}
    ${TIMER_SRC}
    ${LOG_SRC}
	${ANET_FILES}
   )

#link libraries
ADD_LIBRARY(${PROJECTNAME} STATIC ${SRC})
